package com.example.administrator.recorddemo20181101.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.example.administrator.recorddemo20181101.R;
import com.example.administrator.recorddemo20181101.bean.FolderBean;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

public class FolderAdapter extends BaseAdapter {
    private List<FolderBean> data;
    private Context mContext;
    private LayoutInflater mLayoutInflater;

    public FolderAdapter(Context context, List<FolderBean> filePath) {
        this.mContext = context;
        this.data = filePath;
        mLayoutInflater = LayoutInflater.from(mContext);
    }

    @Override
    public int getCount() {
        return data.size();
    }

    @Override
    public Object getItem(int position) {
        return data.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewH viewH = null;
        if (convertView == null) {
            viewH = new ViewH();
            convertView = mLayoutInflater.inflate(R.layout.item_folder_list, null);
            viewH.tvBookName = (TextView) convertView.findViewById(R.id.tvBookName);
            convertView.setTag(viewH);
        } else {
            viewH = (ViewH) convertView.getTag();
        }
        viewH.tvBookName.setText(data.get(position).getFolder_name());
        return convertView;
    }

    class ViewH {
        TextView tvBookName;// 账本名
    }
}
